<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title></title>
</head>
<body>
<script type="text/javascript" src="../static/js/jquery.min.js"></script>
<script type="text/javascript" src="../static/js/jquery.qrcode.js"></script>
<script type="text/javascript" src="../static/js/qrcode.js"></script>
 
<script type="text/javascript" src="../static/js/utf.js"></script>

<a href='https://gitee.com/coczzz/QRCode'><img src='https://gitee.com/coczzz/QRCode/widgets/widget_3.svg' alt='Fork me on Gitee'></img></a>

<p>Render in canvas</p>
<div id="qrcodeCanvas"></div>

<img id='img2' style='border:1px solid red;'/>
<script>

    var qrcode1 = jQuery('#qrcodeCanvas').qrcode({
        render: "canvas",
        text: "https://gitee.com/coczzz/",
        width: "200",               //二维码的宽度
        height: "200",              //二维码的高度
        background: "#FFF",         //二维码的后景色
        foreground: "#000",         //二维码的前景色
        src: 'we.jpg'                //二维码中间的图片
    }).hide();
    qrcode1.show();

    var canvas1 = qrcode1.find('canvas').get(0);
    console.log(canvas1)

    $('#img2').attr('src',canvas1.toDataURL('image/jpg'));

</script>

</body>
</html>